# Maintainer: justforlxz <justforlxz@gmail.com>
pkgname=golang-github-linuxdeepin-go-x11-client-git
pkgver=0.6.8.r2.g9476531
pkgrel=1
sourcename=go-x11-client
pkgsourcename="golang-github-linuxdeepin-go-x11-client"
sourcetars=("$pkgsourcename"_"$pkgver".tar.xz vendor.tar.gz)
sourcedir="$sourcename"
pkgdesc='X11 protocol go language binding'
arch=('any')
url="https://github.com/linuxdeepin/go-x11-client"
license=('GPL')
conflicts=('golang-github-linuxdeepin-go-x11-client')
provides=('golang-github-linuxdeepin-go-x11-client')
groups=('deepin-git')
makedepends=('git' 'go' 'xorg-server-xvfb')
checkdepends=('xorg-server-xvfb' 'git')
source=("${sourcetars[@]}")
sha512sums=('SKIP' 'SKIP')

prepare() {
  cd $sourcedir
  rm -rf tools
}

check() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  #export GO111MODULE=off
  mkdir -p "$srcdir"/build/src/github.com/linuxdeepin
  mv "$srcdir"/vendor "$srcdir"/"$sourcedir"/vendor
  cp -a "$srcdir/$sourcedir" "$srcdir"/build/src/github.com/linuxdeepin/go-x11-client
  cd "$srcdir"/build/src/github.com/linuxdeepin/go-x11-client
  xvfb-run go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin
  cp -a "$srcdir/$sourcedir" "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin/go-x11-client
  rm -r "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin/go-x11-client/debian
}
